home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / DriverGestalt.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  30.9 KB  |  675 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        DriverGestalt.h
  3.  
  4.      Contains:    Driver Gestalt interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DRIVERGESTALT__
  18. #define __DRIVERGESTALT__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __OSUTILS__
  25.     #include <OSUtils.h>
  26. #endif
  27.  
  28. #ifndef __NAMEREGISTRY__
  29.     #include <NameRegistry.h>
  30. #endif
  31.  
  32. #ifndef __SCSI__
  33.     #include <SCSI.h>
  34. #endif
  35.  
  36. #ifndef __USB__
  37.     #include <USB.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. /*__________________________________________________________________________________*/
  64. /* The Driver Gestalt bit in the dCtlFlags */
  65. enum {
  66.     kbDriverGestaltEnable        = 2,
  67.     kmDriverGestaltEnableMask    = (1 << kbDriverGestaltEnable)
  68. };
  69.  
  70. /*__________________________________________________________________________________*/
  71. /* Driver Gestalt related csCodes */
  72. enum {
  73.     kDriverGestaltCode            = 43,                            /* various uses */
  74.     kDriverConfigureCode        = 43,                            /* various uses */
  75.     kcsSetBootPartitionCode        = 44,                            /* Set Startup Partition Control Call */
  76.     kcsGetBootPartitionStatus    = 44,                            /* Get Startup Partition Status Call */
  77.     kdgLowPowerMode                = 70,                            /* Sets/Returns the current energy consumption level */
  78.     kdgReturnDeviceID            = 120,                            /* returns SCSI DevID in csParam[0] */
  79.     kdgGetCDDeviceInfo            = 121                            /* returns CDDeviceCharacteristics in csParam[0] */
  80. };
  81.  
  82. /*__________________________________________________________________________________*/
  83. /* Driver Gestalt selectors */
  84. enum {
  85.     kdgVersion                    = FOUR_CHAR_CODE('vers'),        /* Version number of the driver in standard Apple format */
  86.     kdgDeviceType                = FOUR_CHAR_CODE('devt'),        /* The type of device the driver is driving. */
  87.     kdgInterface                = FOUR_CHAR_CODE('intf'),        /* The underlying interface that the driver is using (if any) */
  88.     kdgSync                        = FOUR_CHAR_CODE('sync'),        /* True if driver only behaves synchronously. */
  89.     kdgBoot                        = FOUR_CHAR_CODE('boot'),        /* value to place in PRAM for this drive (long) */
  90.     kdgWide                        = FOUR_CHAR_CODE('wide'),        /* True if driver supports ioWPosOffset */
  91.     kdgPurge                    = FOUR_CHAR_CODE('purg'),        /* Driver purge permission (True = purge; False = no purge) */
  92.     kdgSupportsSwitching        = FOUR_CHAR_CODE('lpwr'),        /* True if driver supports power switching */
  93.     kdgMin3VPower                = FOUR_CHAR_CODE('pmn3'),        /* Minimum 3.3V power consumption in microWatts */
  94.     kdgMin5VPower                = FOUR_CHAR_CODE('pmn5'),        /* Minimum 5V power consumption in microWatts */
  95.     kdgMax3VPower                = FOUR_CHAR_CODE('pmx3'),        /* Maximum 3.3V power consumption in microWatts */
  96.     kdgMax5VPower                = FOUR_CHAR_CODE('pmx5'),        /* Maximum 5V power consumption in microWatts */
  97.     kdgInHighPower                = FOUR_CHAR_CODE('psta'),        /* True if device is currently in high power mode */
  98.     kdgSupportsPowerCtl            = FOUR_CHAR_CODE('psup'),        /* True if driver supports following five calls */
  99.     kdgAPI                        = FOUR_CHAR_CODE('dAPI'),        /* API support for PC Exchange */
  100.     kdgEject                    = FOUR_CHAR_CODE('ejec'),        /* Eject options for shutdown/restart (Shutdown Mgr) */
  101.     kdgFlush                    = FOUR_CHAR_CODE('flus'),        /* Determine if disk driver supports flush and if it needs a flush */
  102.     kdgVMOptions                = FOUR_CHAR_CODE('vmop'),        /* Disk drive's Virtual Memory options */
  103.     kdgMediaInfo                = FOUR_CHAR_CODE('minf'),        /* return media specific information */
  104.     kdgPhysDriveIconSuite        = FOUR_CHAR_CODE('dics'),        /* Return a pointer to a IconFamily ('icns') data structure for */
  105.                                                                 /* Disk Driver physical drive (formerly in csCode 21) in driverGestaltResponse. */
  106.     kdgMediaIconSuite            = FOUR_CHAR_CODE('mics'),        /* Return a pointer to a IconFamily ('icns') data structure for */
  107.                                                                 /* Disk Driver media (formerly in csCode 22) in driverGestaltResponse. */
  108.                                                                 /* See IconServices.r for information detailing the 'icns' resource data format */
  109.     kdgMediaName                = FOUR_CHAR_CODE('mnam'),        /* Return a pointer to a pascal string describing the Disk Driver (formerly in csCode 21) in driverGestaltResponse. */
  110.                                                                 /* DriverGestalt selector for ATA drivers to signify that they are device 0/1 compliant. */
  111.                                                                 /* see http://developer.apple.com/techpubs/hardware/Developer_Notes/System_Software/ATA_Device_Zero_One.pdf */
  112.     kdgATADev1                    = FOUR_CHAR_CODE('dev1'),
  113.     kdgDeviceReference            = FOUR_CHAR_CODE('dvrf'),        /* Returns a 32-bit reference number for the device, format is interface specific */
  114.     kdgNameRegistryEntry        = FOUR_CHAR_CODE('nmrg'),        /* Returns a pointer to the Name Registry ID for the device */
  115.     kdgDeviceModelInfo            = FOUR_CHAR_CODE('info'),        /* Returns a pointer to a Device Model Info structure */
  116.     kdgSupportedMediaTypes        = FOUR_CHAR_CODE('mdty'),        /* Returns a count and a pointer to list of all media types supported by the device */
  117.     kdgOpenFirmwareBootSupport    = FOUR_CHAR_CODE('ofpt'),        /* Returns information that Open Firmware needs to support booting from the device */
  118.     kdgOpenFirmwareBootingSupport = FOUR_CHAR_CODE('ofbt')        /* Returns same information as kdgOpenFirmwareBootSupport, but is only used during booting*/
  119. };
  120.  
  121. /*__________________________________________________________________________________*/
  122. /* Driver Configure selectors */
  123. enum {
  124.     kdcFlush                    = FOUR_CHAR_CODE('flus'),        /* Tell a disk driver to flush its cache and any hardware caches */
  125.     kdcVMOptions                = FOUR_CHAR_CODE('vmop')        /* Change the disk driver's Virtual Memory options */
  126. };
  127.  
  128. /*__________________________________________________________________________________*/
  129. /* control parameter block for Driver Configure calls */
  130.  
  131. struct DriverConfigParam {
  132.     QElemPtr                         qLink;
  133.     short                             qType;
  134.     short                             ioTrap;
  135.     Ptr                             ioCmdAddr;
  136.     ProcPtr                         ioCompletion;
  137.     OSErr                             ioResult;
  138.     StringPtr                         ioNamePtr;
  139.     short                             ioVRefNum;
  140.     short                             ioCRefNum;                    /* refNum for I/O operation */
  141.     short                             csCode;                        /* == kDriverConfigureCode */
  142.     OSType                             driverConfigureSelector;
  143.     UInt32                             driverConfigureParameter;
  144. };
  145. typedef struct DriverConfigParam        DriverConfigParam;
  146. /*__________________________________________________________________________________*/
  147. /* status parameter block for Driver Gestalt calls */
  148.  
  149. struct DriverGestaltParam {
  150.     QElemPtr                         qLink;
  151.     short                             qType;
  152.     short                             ioTrap;
  153.     Ptr                             ioCmdAddr;
  154.     ProcPtr                         ioCompletion;
  155.     OSErr                             ioResult;
  156.     StringPtr                         ioNamePtr;
  157.     short                             ioVRefNum;
  158.     short                             ioCRefNum;                    /* refNum for I/O operation */
  159.     short                             csCode;                        /*    == kDriverGestaltCode */
  160.     OSType                             driverGestaltSelector;        /* 'sync', 'vers', etc. */
  161.     UInt32                             driverGestaltResponse;        /* Could be a pointer, bit field or other format */
  162.     UInt32                             driverGestaltResponse1;        /* Could be a pointer, bit field or other format */
  163.     UInt32                             driverGestaltResponse2;        /* Could be a pointer, bit field or other format */
  164.     UInt32                             driverGestaltResponse3;        /* Could be a pointer, bit field or other format */
  165.     UInt16                             driverGestaltfiller;        /* To pad out to the size of a controlPB */
  166. };
  167. typedef struct DriverGestaltParam        DriverGestaltParam;
  168. /* Note that the various response definitions are overlays of the response fields above.
  169.        For instance the deviceType response would be returned in driverGestaltResponse.
  170.        The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
  171.     */
  172. /* GetDriverGestaltDevTResponse(gestaltPtr)->deviceType */
  173. #define GetDriverGestaltDevTResponse(p) ((DriverGestaltDevTResponse *)(&((p)->driverGestaltResponse)))
  174. #define GetDriverGestaltIntfResponse(p) ((DriverGestaltIntfResponse *)(&((p)->driverGestaltResponse)))
  175. #define GetDriverGestaltPowerResponse(p) ((DriverGestaltPowerResponse *)(&((p)->driverGestaltResponse)))
  176. #define GetDriverGestaltSyncResponse(p) ((DriverGestaltSyncResponse *)(&((p)->driverGestaltResponse)))
  177. #define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
  178. #define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
  179. #define GetDriverGestaltPurgeResponse(p) ((DriverGestaltPurgeResponse *)(&((p)->driverGestaltResponse)))
  180. #define GetDriverGestaltEjectResponse(p) ((DriverGestaltEjectResponse *)(&((p)->driverGestaltResponse)))
  181. #define GetDriverGestaltVersionResponse(p) (((NumVersion*)(&((p)->driverGestaltResponse))))
  182. #define GetDriverGestaltAPIResponse(p) ((DriverGestaltAPIResponse *)(&((p)->driverGestaltResponse)))
  183. #define GetDriverGestaltBooleanResponse(p) ((Boolean *)(&((p)->driverGestaltResponse)))
  184. #define GetDriverGestaltFlushResponse(p) ((DriverGestaltFlushResponse *)(&((p)->driverGestaltResponse)))
  185. #define GetDriverGestaltVMOptionsResponse(p) ((DriverGestaltVMOptionsResponse *)(&((p)->driverGestaltResponse)))
  186. #define GetDriverGestaltMediaInfoResponse(p) ((DriverGestaltMediaInfoResponse *)(&((p)->driverGestaltResponse)))
  187. #define GetDriverGestaltDeviceReferenceResponse(p) ((DriverGestaltDeviceReferenceResponse *)(&((p)->driverGestaltResponse)))
  188. #define GetDriverGestaltNameRegistryResponse(p) ((DriverGestaltNameRegistryResponse *)(&((p)->driverGestaltResponse)))
  189. #define GetDriverGestaltDeviceModelInfoResponse(p) ((DriverGestaltDeviceModelInfoResponse **)(&((p)->driverGestaltResponse)))
  190. #define GetDriverGestaltSupportedMediaTypesResponse(p) ((DriverGestaltSupportedMediaTypesResponse **)(&((p)->driverGestaltResponse)))
  191. #define GetDriverGestaltOFBootSupportResponse(p) ((DriverGestaltOFBootSupportResponse *)(&((p)->driverGestaltResponse)))
  192. #define GetDriverGestaltATADev1Response(p)    ((DriverGestaltATADev1Response *) (&((p)->driverGestaltResponse)))
  193. /*__________________________________________________________________________________*/
  194. /* Device Types response */
  195.  
  196. struct DriverGestaltDevTResponse {
  197.     OSType                             deviceType;
  198. };
  199. typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
  200. enum {
  201.     kdgDiskType                    = FOUR_CHAR_CODE('disk'),        /* standard r/w disk drive */
  202.     kdgTapeType                    = FOUR_CHAR_CODE('tape'),        /* tape drive */
  203.     kdgPrinterType                = FOUR_CHAR_CODE('prnt'),        /* printer */
  204.     kdgProcessorType            = FOUR_CHAR_CODE('proc'),        /* processor */
  205.     kdgWormType                    = FOUR_CHAR_CODE('worm'),        /* write-once */
  206.     kdgCDType                    = FOUR_CHAR_CODE('cdrm'),        /* cd-rom drive */
  207.     kdgFloppyType                = FOUR_CHAR_CODE('flop'),        /* floppy disk drive */
  208.     kdgScannerType                = FOUR_CHAR_CODE('scan'),        /* scanner */
  209.     kdgFileType                    = FOUR_CHAR_CODE('file'),        /* Logical Partition type based on a file (Drive Container) */
  210.     kdgRemovableType            = FOUR_CHAR_CODE('rdsk')        /* A removable media hard disk drive ie. Syquest, Bernioulli */
  211. };
  212.  
  213. /*__________________________________________________________________________________*/
  214. /* Device Interfaces response */
  215.  
  216. struct DriverGestaltIntfResponse {
  217.     OSType                             interfaceType;
  218. };
  219. typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
  220. enum {
  221.     kdgScsiIntf                    = FOUR_CHAR_CODE('scsi'),
  222.     kdgPcmciaIntf                = FOUR_CHAR_CODE('pcmc'),
  223.     kdgATAIntf                    = FOUR_CHAR_CODE('ata '),
  224.     kdgUSBIntf                    = FOUR_CHAR_CODE('usb '),
  225.     kdgFireWireIntf                = FOUR_CHAR_CODE('fire'),
  226.     kdgExtBus                    = FOUR_CHAR_CODE('card'),
  227.     kdgNetworkIntf                = FOUR_CHAR_CODE('net ')
  228. };
  229.  
  230. /*__________________________________________________________________________________*/
  231. /* Power Saving */
  232.  
  233. struct DriverGestaltPowerResponse {
  234.     unsigned long                     powerValue;                    /* Power consumed in .Watts */
  235. };
  236. typedef struct DriverGestaltPowerResponse DriverGestaltPowerResponse;
  237. /*__________________________________________________________________________________*/
  238. /* Disk Specific */
  239.  
  240. struct DriverGestaltSyncResponse {
  241.     Boolean                         behavesSynchronously;
  242.     UInt8                             pad[3];
  243. };
  244. typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
  245.  
  246. struct DriverGestaltBootResponse {
  247.     UInt8                             extDev;                        /*  Packed target (upper 5 bits) LUN (lower 3 bits) */
  248.     UInt8                             partition;                    /*  Unused */
  249.     UInt8                             SIMSlot;                    /*  Slot */
  250.     UInt8                             SIMsRSRC;                    /*  sRsrcID */
  251. };
  252. typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
  253.  
  254. struct DriverGestaltAPIResponse {
  255.     short                             partitionCmds;                /* if bit 0 is nonzero, supports partition control and status calls */
  256.                                                                 /*         prohibitMounting (control, kProhibitMounting) */
  257.                                                                 /*         partitionToVRef (status, kGetPartitionStatus) */
  258.                                                                 /*         getPartitionInfo (status, kGetPartInfo) */
  259.     short                             unused1;                    /* all the unused fields should be zero */
  260.     short                             unused2;
  261.     short                             unused3;
  262.     short                             unused4;
  263.     short                             unused5;
  264.     short                             unused6;
  265.     short                             unused7;
  266.     short                             unused8;
  267.     short                             unused9;
  268.     short                             unused10;
  269. };
  270. typedef struct DriverGestaltAPIResponse    DriverGestaltAPIResponse;
  271.  
  272. struct DriverGestaltFlushResponse {
  273.     Boolean                         canFlush;                    /* Return true if driver supports the */
  274.                                                                 /* kdcFlush Driver Configure _Control call */
  275.     Boolean                         needsFlush;                    /* Return true if driver/device has data cached */
  276.                                                                 /* and needs to be flushed when the disk volume */
  277.                                                                 /* is flushed by the File Manager */
  278.     UInt8                             pad[2];
  279. };
  280. typedef struct DriverGestaltFlushResponse DriverGestaltFlushResponse;
  281. /* Flags for purge permissions */
  282. enum {
  283.     kbCloseOk                    = 0,                            /* Ok to call Close */
  284.     kbRemoveOk                    = 1,                            /* Ok to call RemoveDrvr */
  285.     kbPurgeOk                    = 2,                            /* Ok to call DisposePtr */
  286.     kmNoCloseNoPurge            = 0,
  287.     kmOkCloseNoPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk),
  288.     kmOkCloseOkPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk) + (1 << kbPurgeOk)
  289. };
  290.  
  291. /* Driver purge permission structure */
  292.  
  293. struct DriverGestaltPurgeResponse {
  294.     UInt16                             purgePermission;            /* 0 = Do not change the state of the driver */
  295.                                                                 /* 3 = Do Close() and DrvrRemove() this driver */
  296.                                                                 /* but don't deallocate driver code */
  297.                                                                 /* 7 = Do Close(), DrvrRemove(), and DisposePtr() */
  298.     UInt16                             purgeReserved;
  299.     Ptr                             purgeDriverPointer;            /* pointer to the start of the driver block (valid */
  300.                                                                 /* only of DisposePtr permission is given */
  301. };
  302. typedef struct DriverGestaltPurgeResponse DriverGestaltPurgeResponse;
  303.  
  304. struct DriverGestaltEjectResponse {
  305.     UInt32                             ejectFeatures;                /*  */
  306. };
  307. typedef struct DriverGestaltEjectResponse DriverGestaltEjectResponse;
  308. /* Flags for Ejection Features field */
  309. enum {
  310.     kRestartDontEject            = 0,                            /* Dont Want eject during Restart */
  311.     kShutDownDontEject            = 1,                            /* Dont Want eject during Shutdown */
  312.     kRestartDontEject_Mask        = 1 << kRestartDontEject,
  313.     kShutDownDontEject_Mask        = 1 << kShutDownDontEject
  314. };
  315.  
  316. /*
  317.     The DriverGestaltVMOptionsResponse is returned by a disk driver in response to a
  318.     kdgVMOptions Driver Gestalt request. This allows a disk driver to tell VM a few
  319.     things about a disk drive. For example:
  320.     
  321.     o A drive that should never be in the page fault path should return kAllowVMNoneMask.
  322.       Examples of this are drives that have manual eject buttons that are not disabled by
  323.       software, drives with very slow throughput, or drives that depend on
  324.       a network connection.
  325.     o A drive that should never be written to but is safe for read-only file mapping
  326.       should return kAllowVMReadOnlyMask. Examples of this are WORM drives where each write
  327.       eats write-once space on the disk and CD-ROM drives which are read-only media.
  328.     o A drive that should allow VM to create its main backing store file should return
  329.       kAllowVMReadWriteMask. Examples of this are fast read/write drives that don't allow
  330.       manual eject and don't use a network connection.
  331.     
  332.     A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
  333.     what disk drive this call is for. This is a per-drive call, not a per-driver call.
  334.     
  335.     The only three valid responses to kdgVMOptions at this time are kAllowVMNoneMask,
  336.     kAllowVMReadOnlyMask, and kAllowVMReadWriteMask (i.e., setting only kAllowVMWriteBit
  337.     is not valid).
  338.     
  339.     Important: All bits not defined here are reserved and should be set to zero until
  340.     they are defined for a specific purpose.
  341.     
  342.     The kdcVMOptions Driver Configure _Control call provides the ability to change a driver's
  343.     response to kdgVMOptions Driver Gestalt requests. A driver should return controlErr if
  344.     it doesn't want to provide the ability to change the kdgVMOptions response. If a driver
  345.     supports the kdcVMOptions Driver Configure _Control call, but is asked to set an option bit
  346.     that it doesn't support (for example, if a read-only device is asked to set the kAllowVMWriteBit),
  347.     it should return paramErr.
  348. */
  349.  
  350. struct DriverGestaltVMOptionsResponse {
  351.     UInt32                             vmOptions;
  352. };
  353. typedef struct DriverGestaltVMOptionsResponse DriverGestaltVMOptionsResponse;
  354. /* Bits and masks for DriverGestaltVMOptionsResponse.vmOptions field */
  355. enum {
  356.     kAllowVMReadBit                = 0,                            /* Allow VM to use this drive for read access */
  357.     kAllowVMWriteBit            = 1,                            /* Allow VM to use this drive for write access */
  358.     kAllowVMNoneMask            = 0,
  359.     kAllowVMReadOnlyMask        = 1 << kAllowVMReadBit,
  360.     kAllowVMReadWriteMask        = (1 << kAllowVMReadBit) + (1 << kAllowVMWriteBit)
  361. };
  362.  
  363. /*
  364.     The DriverGestaltMediaInfoResponse is returned by a disk driver in response to a
  365.     kdgMediaInfo DriverGestalt request. This allows a disk driver to tell callers the
  366.     physical block size, the number of blocks that are of that size, and the media type
  367.     for a given device.
  368.     
  369.     A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
  370.     what disk drive this call is for. This is a per-drive call, not a per-driver call.
  371.     
  372.     On drives that support ejectable media, the response can change depending on what
  373.     media is currently in the drive.
  374. */
  375.  
  376. struct DriverGestaltMediaInfoResponse {
  377.     UInt32                             numberBlocks;                /* number of blocks */
  378.     UInt32                             blockSize;                    /* physical size of blocks */
  379.     SInt16                             mediaType;                    /* media type identifier */
  380. };
  381. typedef struct DriverGestaltMediaInfoResponse DriverGestaltMediaInfoResponse;
  382. /* DriverGestaltMediaInfoResponse.mediaType constants */
  383. enum {
  384.     kMediaTypeUnknown            = 128,                            /* media type is unknown */
  385.     kMediaTypeCDROM                = 129,                            /* media type is a CD-ROM */
  386.     kMediaTypeDVDROM            = 130,                            /* media type is a DVD-ROM */
  387.     kMediaTypeDVDRAM            = 131,                            /* media type is a DVD-RAM */
  388.     kMediaTypeDVDR                = 132,                            /* media type is a DVD-RW */
  389.     kMediaTypeReadOnly            = 133,                            /* basic read only type */
  390.     kMediaTypeWriteOnce            = 134,                            /* basic write once type */
  391.     kMediaTypeRewritable        = 135,                            /* rewritable media, i.e CD-RW */
  392.     kMediaTypeOverwritable        = 136,                            /* random access read write media */
  393.     kMediaTypeNoMedia            = -1                            /* no media is present */
  394. };
  395.  
  396.  
  397. struct DriverGestaltATADev1Response {
  398.     UInt32                             dev1Support;                /* 1 = supports devices 0 and 1*/
  399. };
  400. typedef struct DriverGestaltATADev1Response DriverGestaltATADev1Response;
  401. /*__________________________________________________________________________________*/
  402. /* Device Reference */
  403. /*
  404.     The driver will return a 32-bit device reference number in the driverGestaltResponse
  405.     field of the DriverGestaltParam structure. The device refernce number will be interpreted 
  406.     differently depending on the interface retrieved by using the 'intf' Driver Gestalt call.
  407. */
  408. /*The union for the kdgDeviceReference Gestalt */
  409.  
  410. union DriverGestaltDeviceReferenceResponse {
  411.     UInt32                             devRef;                        /* Generic reference number for interfaces not specified */
  412.     DeviceIdent                     scsiID;                        /* kdgScsiIntf devices will return a DeviceIdent */
  413.     DeviceIdent                     ataID;                        /* kdgATAIntf devices will return a DeviceIdent */
  414.     USBDeviceRef                     usbRef;                        /* kdgUSBIntf devices will return a USBDeviceRef*/
  415. };
  416. typedef union DriverGestaltDeviceReferenceResponse DriverGestaltDeviceReferenceResponse;
  417. /*__________________________________________________________________________________*/
  418. /* Name Registry ID */
  419. /*
  420.     The driver will pass back in the driverGestaltResponse field of the DriverGestaltParam
  421.     a pointer to the Name Registry Entry ID for the device that it controls
  422. */
  423. /* The structure for the kdgNameRegistryEntry Gestalt */
  424.  
  425. struct DriverGestaltNameRegistryResponse {
  426.     RegEntryIDPtr                     entryID;
  427. };
  428. typedef struct DriverGestaltNameRegistryResponse DriverGestaltNameRegistryResponse;
  429. /*__________________________________________________________________________________*/
  430. /* Device Model Information */
  431. /*
  432.     The driver will pass a pointer to the DriverGestaltDeviceModelInfoResponse in the
  433.     driverGestaltResponse field of the DriverGestaltParam structure
  434.  
  435.     The structure for the kdgDeviceModelInfo Gestalt
  436.     If any of theses pointers are nil, that means that the device doesn't provide that information
  437. */
  438.  
  439. struct DriverGestaltDeviceModelInfoResponse {
  440.     UInt32                             infoStructVersion;
  441.     StringPtr                         vendorName;
  442.     StringPtr                         productName;
  443.     StringPtr                         revisionNumber;
  444.     StringPtr                         subRevisionNumber;
  445.     StringPtr                         serialNumber;
  446. };
  447. typedef struct DriverGestaltDeviceModelInfoResponse DriverGestaltDeviceModelInfoResponse;
  448. /* infoStructVersion field values */
  449. /* NOTE: May need/want to add a UniCode version of the InfoStruct at some point */
  450. enum {
  451.     kInfoStructStringPtrsVers1    = 1
  452. };
  453.  
  454.  
  455. /*__________________________________________________________________________________*/
  456. /* Supported Media Types */
  457. /*
  458.     The driver will return the number of media types supported by the device in the 
  459.      driverGestaltResponse field of the DriverGestaltParam structure and an array of 
  460.     'devt' values for the supported media types will be returned in the driverGestaltResponse1
  461.     field of the DriverGestaltParam.
  462.  
  463.     This call will return the number of media types supported by the device, and an array
  464.     of 'devt' values for the media types (i.e. if a device supports floppy disks
  465.     and large capacity removables, the driver would return that 2 media types are supported,
  466.     and the array would contain kdgFloppyType ('flop') and kdgRemovableType ('rdsk')).
  467. */
  468. /* The structure for the kdgSupportedMediaTypes Gestalt */
  469.  
  470. struct DriverGestaltSupportedMediaTypesResponse {
  471.     UInt32                             supportTypesCount;            /* The number of Media Types in the array */
  472.     OSType                             supportedTypesArray[1];        /* Array of supported media types  */
  473. };
  474. typedef struct DriverGestaltSupportedMediaTypesResponse DriverGestaltSupportedMediaTypesResponse;
  475. /*__________________________________________________________________________________*/
  476. /* Open Firmware Boot support  and Open Firmware Booting support */
  477. /*
  478.     The kdgOpenFirmwareBootSupport selector is used to get information about boot support 
  479.     for the driver/device.  The kdgOpenFirmwareBootingSupport is used during the boot
  480.     process to allow booting from partitions that Open Firmware may not be able to read
  481.     directly (i.e. Disk Array partitions, encrypted partitions, compressed partitions, etc..)
  482.     
  483.     The driver will return the bootPartitionQualifier value in the driverGestaltResponse 
  484.     field of the DriverGestaltParam and will return the exact partition map entry for
  485.     the boot partition in the driverGestaltResponse1 field of the DriverGestaltParam if
  486.     kOFBootSpecifiedPartition is returned in the driverGestaltResponse.
  487.     The number that is returned for the bootPartitionMapEntry field if the kOFBootSpecifiedPartition 
  488.     is returned is the partition map entry number for the partition. (i.e. If the partition map entry
  489.     for the boot partition is the 2nd partition entry in the partition map, the bootPartitionMapEntry
  490.     field would be set to 2.  If the partition map entry for the boot partition is the 3rd partition 
  491.     map, the bootPartitionMapEntry field would be set to 3 and etc.)
  492. */
  493.  
  494. struct DriverGestaltOFBootSupportResponse {
  495.     UInt32                             bootPartitionQualifier;        /*     The exact level of booting that the driver and device supports */
  496.     UInt32                             bootPartitionMapEntry;        /*     The Partition Map entry for the boot partition if applicable */
  497. };
  498. typedef struct DriverGestaltOFBootSupportResponse DriverGestaltOFBootSupportResponse;
  499. /* Levels of boot support that the driver/device supports */
  500. /* These values are used in the bootPartitionQualifier field of the DriverGestaltOFBootSupportResponse */
  501. enum {
  502.     kOFBootAnyPartition            = 1,
  503.     kOFBootSpecifiedPartition    = 2,
  504.     kOFBootNotBootable            = 3,
  505.     kOFBootNotPartitioned        = 4
  506. };
  507.  
  508. /*__________________________________________________________________________________*/
  509. /* CD-ROM Specific */
  510. /* The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a 
  511.    standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
  512. */
  513.  
  514. struct CDDeviceCharacteristics {
  515.     UInt8                             speedMajor;                    /* High byte of fixed point number containing drive speed */
  516.     UInt8                             speedMinor;                    /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
  517.     UInt16                             cdFeatures;                    /* Flags field for features and transport type of this CD-ROM */
  518. };
  519. typedef struct CDDeviceCharacteristics    CDDeviceCharacteristics;
  520. enum {
  521.     cdFeatureFlagsMask            = 0xFFFC,                        /* The Flags are in the first 14 bits of the cdFeatures field */
  522.     cdTransportMask                = 0x0003                        /* The transport type is in the last 2 bits of the cdFeatures field */
  523. };
  524.  
  525.  
  526. /* Flags for CD Features field */
  527. enum {
  528.     cdPowerInject                = 0,                            /* device supports power inject of media*/
  529.     cdNotPowerEject                = 1,                            /* device does not support power eject of media*/
  530.     cdMute                        = 2,                            /* device supports audio channels muting*/
  531.     cdLeftToChannel                = 3,                            /* device supports left channel only mono audio*/
  532.     cdRightToChannel            = 4,                            /* device supports right channel only mono audio*/
  533.     cdLeftPlusRight                = 5,                            /* device supports left + right channels mono audio*/
  534.     cdSCSI_2                    = 10,                            /* device supports SCSI2 command set (SCSI only)*/
  535.     cdStereoVolume                = 11,                            /* device supports independent volume per channel*/
  536.     cdDisconnect                = 12,                            /* device supports disconnect / reconnect (SCSI only)*/
  537.     cdWriteOnce                    = 13,                            /* device is a write-once type of drive*/
  538.     cdPowerInject_Mask            = 1 << cdPowerInject,
  539.     cdNotPowerEject_Mask        = 1 << cdNotPowerEject,
  540.     cdMute_Mask                    = 1 << cdMute,
  541.     cdLeftToChannel_Mask        = 1 << cdLeftToChannel,
  542.     cdRightToChannel_Mask        = 1 << cdRightToChannel,
  543.     cdLeftPlusRight_Mask        = 1 << cdLeftPlusRight,
  544.     cdSCSI_2_Mask                = 1 << cdSCSI_2,
  545.     cdStereoVolume_Mask            = 1 << cdStereoVolume,
  546.     cdDisconnect_Mask            = 1 << cdDisconnect,
  547.     cdWriteOnce_Mask            = 1 << cdWriteOnce
  548. };
  549.  
  550. /* Transport types */
  551. enum {
  552.     cdCaddy                        = 0,                            /* CD_SC,CD_SC_PLUS,CD-300 etc. - power eject only*/
  553.     cdTray                        = cdPowerInject_Mask,            /* CD_300_PLUS etc. - power inject only*/
  554.     cdLid                        = cdNotPowerEject_Mask            /* Power CD - no power inject/no power eject*/
  555. };
  556.  
  557. /* the following are used by PC Exchange (and Apple DOS/PC Compatibility Card)*/
  558.  
  559. /* Control Codes*/
  560. enum {
  561.     kRegisterPartition            = 50,                            /* PCX needs a new Drive (for a non-macintosh partition found on the disk)*/
  562.     OLD_REGISTER_PARTITION        = 301,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  563.     THE_DRIVE                    = 0,                            /* DrvQElPtr for the partition to register*/
  564.     THE_PHYS_START                = 1,                            /* The start of the partition in logical blocks*/
  565.     THE_PHYS_SIZE                = 2,                            /* The size of the partition in logical blocks*/
  566.     kGetADrive                    = 51,                            /* control call to ask the driver to create a drive*/
  567.     OLD_GET_A_DRIVE                = 302,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  568.     THE_VAR_QUEL                = 0,                            /* a VAR parameter for the returned DrvQElPtr*/
  569.     kProhibitMounting            = 52,                            /* Dont allow mounting of the following drives*/
  570.     kOldProhibitMounting        = 2100,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  571.     kProhibitDevice                = 0,                            /* CS Param 0 and 1 (partInfoRecPtr)*/
  572.     kIsContainerMounted            = 53,
  573.     kOldIsContainerMounted        = 2201,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card            */
  574.     kContainerVRef                = 0,                            /* CS Param 0 and 1 (VRefNum)*/
  575.     kContainerParID                = 1,                            /* CS Param 2 and 3 (Parent ID)*/
  576.     kContainerName                = 2,                            /* CS Param 4 and 5 (File Name)*/
  577.     kContainerResponse            = 3,                            /* CS Param 6 and 7 (VAR pointer to short result)*/
  578.     kMountVolumeImg                = 54,
  579.     OLD_MOUNT_VOLUME_IMG        = 2000,
  580.     MV_HOST_VREFNUM                = 0,
  581.     MV_HOST_PAR_ID                = 1,
  582.     MV_HOST_NAME                = 2,
  583.     MV_REQ_PERM                    = 3
  584. };
  585.  
  586. /* Status Codes*/
  587.  
  588. enum {
  589.     kGetPartitionStatus            = 50,                            /* what is the status of this partition?*/
  590.     kOldGetPartitionStatus        = 2200,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  591.     kDeviceToQuery                = 0,                            /* CS Param 0 and 1 (partInfoRecPtr)*/
  592.     kDeviceResponse                = 1,                            /* CS Param 2 and 3 (VAR pointer to short result)*/
  593.     kGetPartInfo                = 51,                            /* Get a partition info record based on the provided vrefnum*/
  594.     kOldGetPartInfo                = 2300,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  595.     kPartInfoResponse            = 0,                            /* var parameter (pointer to partInfoRec) CSParam [0-1]*/
  596.     kGetContainerAlias            = 52,                            /* Get the alias that describes the file this drive was mounted from.*/
  597.     kOldGetContainerAlias        = 2400,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  598.     kGetAliasResponse            = 0                                /*    var parameter (pointer to a Handle) CSParam [0-1]*/
  599. };
  600.  
  601. /* the result codes to come from the driver interface */
  602.  
  603. enum {
  604.     DRIVER_NOT_INSTALLED        = -1,
  605.     DRIVER_BUSY                    = -2,
  606.     CANT_MOUNT_WITHIN_THIS_FS    = -3,                            /* can only mount container within residing on HFS volume*/
  607.     VOLUME_ALREADY_MOUNTED        = -4                            /* Already Mounted*/
  608. };
  609.  
  610. /* requisite structures for PCX control and status calls*/
  611.  
  612. enum {
  613.     kMaxProhibted                = 2                                /* the max number of volumes the PC can possibly have mounted*/
  614. };
  615.  
  616. /* GestaltSelector for Finding Driver information*/
  617.  
  618. enum {
  619.     kGetDriverInfo                = FOUR_CHAR_CODE('vdrc')
  620. };
  621.  
  622. enum {
  623.     VerifyCmd                    = 5,
  624.     FormatCmd                    = 6,
  625.     EjectCmd                    = 7
  626. };
  627.  
  628. /* Partition information passed back and forth between PCX and the driver*/
  629.  
  630. struct partInfoRec {
  631.     DeviceIdent                     SCSIID;                        /* DeviceIdent for the device*/
  632.     UInt32                             physPartitionLoc;            /* physical block number of beginning of partition*/
  633.     UInt32                             partitionNumber;            /* the partition number of this partition*/
  634. };
  635. typedef struct partInfoRec                partInfoRec;
  636. typedef partInfoRec *                    partInfoRecPtr;
  637.  
  638. struct vPartInfoRec {
  639.     UInt8                             VPRTVers;                    /* Virtual partition version number*/
  640.     UInt8                             VPRTType;                    /* virtual partition type (DOS, HFS, etc)*/
  641.     SInt16                             drvrRefNum;                    /* Driver Reference number of partition driver*/
  642. };
  643. typedef struct vPartInfoRec                vPartInfoRec;
  644. typedef vPartInfoRec *                    vPartInfoRecPtr;
  645. /* Information related to DOS partitions*/
  646. enum {
  647.     kDOSSigLow                    = 0x01FE,                        /* offset into boot block for DOS signature*/
  648.     kDOSSigHi                    = 0x01FF,                        /* offset into boot block for DOS signature*/
  649.     kDOSSigValLo                = 0x55,                            /* DOS signature value in low byte*/
  650.     kDOSSigValHi                = 0xAA                            /* DOS signature value in high byte*/
  651. };
  652.  
  653.  
  654.  
  655. #if PRAGMA_STRUCT_ALIGN
  656.     #pragma options align=reset
  657. #elif PRAGMA_STRUCT_PACKPUSH
  658.     #pragma pack(pop)
  659. #elif PRAGMA_STRUCT_PACK
  660.     #pragma pack()
  661. #endif
  662.  
  663. #ifdef PRAGMA_IMPORT_OFF
  664. #pragma import off
  665. #elif PRAGMA_IMPORT
  666. #pragma import reset
  667. #endif
  668.  
  669. #ifdef __cplusplus
  670. }
  671. #endif
  672.  
  673. #endif /* __DRIVERGESTALT__ */
  674.  
  675.